﻿Imports 坐标转换类

Public Class 求新坐标系上的P点在当前坐标系上的坐标

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Dim bs As New BindingSource
        'bs.DataSource = dt
        'grd.DataSource = bs

        'SetParent(Me.Handle, FindWindow("Progman", "Program Manager"))



        grd.Rows.Add(1)
        grd.Rows(0).Cells(0).Value = 360
        grd.Rows(0).Cells(1).Value = 272






    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim X, Y, Angle As Single
        Dim P, P1 As PointF
        Dim pointNo As Integer
        pointNo = grd.RowCount - 1

        X = X_Num.Value
        Y = Y_Num.Value
        Angle = (Angel_Num.Value)

        For i = 0 To pointNo - 1
            P1.X = grd.Rows(i).Cells(0).Value
            P1.Y = grd.Rows(i).Cells(1).Value
            P = CoordTrans.P1toP_Transform(X, Y, Angle, P1)
            grd.Rows(i).Cells(2).Value = P.X
            grd.Rows(i).Cells(3).Value = P.Y
        Next

    End Sub
End Class
